package com.woniu.bh.beautysalon.web.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.woniu.bh.beautysalon.model.dto.AllTechniciansDto;
import com.woniu.bh.beautysalon.model.dto.CheckDto;
import com.woniu.bh.beautysalon.model.dto.TechnicianRankDto;
import com.woniu.bh.common.core.domain.technician.Technician;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author cxb
 * @since 2020-10-13
 */
public interface TechnicianMapper extends BaseMapper<Technician> {
    /**
     * 美容师服务排行榜
     * @param beautysalonId
     * @return
     */
    List<TechnicianRankDto> technicianRank(Integer beautysalonId);
    /**
     * @description: 所有美容师
     * @param: page
     * @param: technicianUsername
     * @param: sex
     * @param: beforeAge
     * @param: afterAge
     * @return: com.baomidou.mybatisplus.core.metadata.IPage<com.woniu.project.beautysalon.dto.AllTechniciansDto>
     */
    IPage<AllTechniciansDto> pageQuery(Page<AllTechniciansDto> page, @Param("technicianName") String technicianName, @Param("sex") String sex, @Param("beforeAge") Integer beforeAge, @Param("afterAge") Integer afterAge);
    /**
     * @description:
     * @param: page
     * @param: technicianUserName
     * @param: technicianSex
     * @param: beforeAge
     * @param: afterAge
     * @return: com.baomidou.mybatisplus.core.metadata.IPage<com.woniu.bh.beautysalon.model.dto.AllTechniciansDto>
     */
    IPage<AllTechniciansDto> getMyTechnicians(Page<AllTechniciansDto> page,@Param("beautysalonId") Integer beautysalonId,@Param("technicianName")String technicianName,@Param("technicianSex") String technicianSex,@Param("beforeAge") Integer beforeAge,@Param("afterAge") Integer afterAge);
    /**
     * @description: 审核表查询
     * @param: page
     * @param: beautysalonId
     * @return: com.baomidou.mybatisplus.core.metadata.IPage
     */
    IPage<CheckDto> getAllCheck(Page<CheckDto> page,@Param("beautysalonId") Integer beautysalonId);

    /**
     * @description: 查询美容师提供的服务
     * @param: technicianId
     * @return: java.util.List<java.lang.Object>
     */
    @Select("select service_name from bh_technician t LEFT JOIN bh_service_technician s on t.technician_id = s.technician_id\n" +
            "LEFT JOIN bh_beautysalon_service b on b.service_id = s.service_id where t.technician_id = #{technicianId}")
    List<Object> masterService(@Param("technicianId") Integer technicianId);
}
